package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class CheckIfAnArrayContainsAValue {
	public static void main(String[] argv) {
		Object[] array = new String[]{"1", "abc", "level",
				"www.tah1986.com", "asdf 123"};
		Object needle = "www.tah1986.com";
		System.out.println("数组是否包含 www.tah1986.com ？" + arrayContains(array, needle));
	}

	public static boolean arrayContains(Object[] array, Object needle) {
		for (Object arrayItem : array) {
			if (arrayItem.equals(needle)) {
				return true;
			}
		}
		return false;
	}
}
